package cn.dakaqi.dao;

import cn.dakaqi.entities.Group;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

/**
 * Created by chunyang on 2016/3/21.
 */
public interface GroupDao extends PagingAndSortingRepository<Group, Long>, JpaSpecificationExecutor<Group>
{

        Page<Group> findByName(String name, Pageable pageRequest);
        Group findByGroupCode(String groupCode);
        @Query(nativeQuery = true, value = "select CODE as act from U_AREA_PROVINCE where NAME like %:province%")
        public String queryProvinceCode(@Param("province") String province);
//	@Modifying
//	@Query("delete from Activity activity where activity.user.id=?1")
//	void deleteByUserId(Long id);
}
